# -*- coding: utf-8 -*-
# @Time    : 2019/11/7 18:17
# @Author  : xiao
from poco.drivers.android.uiautomation import AndroidUiautomationPoco
from airtest.core.api import *
from airtest.core.api import connect_device, device
# POCO = AndroidUiautomationPoco(force_restart=False,screenshot_each_action=False)
from basic.data.data import getIsrealDevice


class Android():
    device=getIsrealDevice()
    if device is False:
        print('使用模拟器允许')
        ##模拟器执行的时候
        device_1 = connect_device("android:///127.0.0.1:7555?cap_method=javacap&touch_method=adb")
        poco=AndroidUiautomationPoco(device=device_1,force_restart=False, screenshot_each_action=False)
    else:
        print('使用真机运行')
        # 真机执行
        poco = AndroidUiautomationPoco( force_restart=False, screenshot_each_action=False)
        print(poco)
